package com.gxa.controller.department;

import com.gxa.common.R.ResponseData;
import com.gxa.service.department.DeptService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

/*
1.1 部门组织架构
\ */
@Controller
@Api(value = "部门结构test",tags = "部门结构接口API")
@RequestMapping("/dept")
public class DeptStructureController {

    @Autowired
    private DeptService deptService;//调用service层接口


    /*
    1.1.1 查询出的部门分级
     */
    @RequestMapping(value = "/findDeptType", method = RequestMethod.GET)
    @ApiOperation(value = "部门分级查询接口", notes = "提供当前页码数与每页显示条数", httpMethod = "get", response = ResponseData.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage", value = "当前页数", required = true, dataType = "String"),
            @ApiImplicitParam(name = "pageSize", value = "每页显示条数", required = true, dataType = "String"),
    })//显示页面
    @ApiResponses({
            @ApiResponse(code = 200, message = "请求成功"),
            @ApiResponse(code = 404, message = "页面未找到"),
            @ApiResponse(code = 500, message = "后台处理错误")
    })
    @ResponseBody //返回对象
    public ResponseData findDeptType(@RequestParam(name = "currentPage") String currentPage,
                                     @RequestParam(name = "pageSize") String pageSize) {
        return deptService.findDeptType(currentPage, pageSize);
    }


    /*
    1.1.2 查询部门员工
     */
    @RequestMapping(value = "/findEmployeeList", method = RequestMethod.GET)
    @ApiOperation(value = "员工查询接口", notes = "提供当前页码数与每页显示条数", httpMethod = "get", response = ResponseData.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage", value = "当前页数", required = true, dataType = "String"),
            @ApiImplicitParam(name = "pageSize", value = "每页显示条数", required = true, dataType = "String"),
    })//显示页面
    @ApiResponses({
            @ApiResponse(code = 200, message = "请求成功"),
            @ApiResponse(code = 404, message = "页面未找到"),
            @ApiResponse(code = 500, message = "后台处理错误")
    })
    @ResponseBody //返回对象
    public ResponseData findEmployeeList(@RequestParam(name = "currentPage") String currentPage,
                                         @RequestParam(name = "pageSize") String pageSize) {
        return deptService.findEmployeeList(currentPage, pageSize);
    }


    /*
    1.1.3 查询员工信息
     */
    @RequestMapping(value = "/findEmpInformationList", method = RequestMethod.GET)
    @ApiOperation(value = "员工信息查询接口", notes = "提供当前页码数与每页显示条数", httpMethod = "get", response = ResponseData.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "currentPage", value = "当前页数", required = true, dataType = "String"),
            @ApiImplicitParam(name = "pageSize", value = "每页显示条数", required = true, dataType = "String"),
    })//显示页面
    @ApiResponses({
            @ApiResponse(code = 200, message = "请求成功"),
            @ApiResponse(code = 404, message = "页面未找到"),
            @ApiResponse(code = 500, message = "后台处理错误")
    })
    @ResponseBody //返回对象
    public ResponseData findEmpInformationList(@RequestParam(name = "currentPage") String currentPage,
                                               @RequestParam(name = "pageSize") String pageSize) {
        return deptService.findEmpInformationList(currentPage, pageSize);
    }
}
